<?php

namespace app\admin\model;
use think\model\concern\SoftDelete;

use think\Model;

class CartModel extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    // 设置当前模型对应的完整数据表名称
    protected $name = 'cart';
    //定义主键
    protected $pk = 'id';

    //关联用户模型
    public function user()
    {
        return $this->belongsTo('UserModel', 'u_id', 'id');
    }

    //关联商品模型
    public function goods()
    {
        return $this->belongsTo('GoodsModel');
    }
}
